package org.junv;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


@WebServlet("/DelEquip")
public class DelEquip extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
   
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		response.setContentType("text/html;charset=utf-8");    
		PrintWriter out = response.getWriter();
		    String equipId = request.getParameter("equipId");
		    String sql = "DELETE FROM equipInfo  WHERE equipId="+equipId;
			String sql2 = "DELETE FROM equipBorrAble  WHERE equipId="+equipId;
			String sql3 = "DELETE FROM equipToCate  WHERE equipId="+equipId;
			DBBean myBean = new DBBean();
			myBean.init();
			if(myBean.executeUpdate(sql2)&&myBean.executeUpdate(sql3)&&myBean.executeUpdate(sql)){
			
			   
			    out.println("删除成功!");
			    response.sendRedirect("manageEquip.html");
			}else{
				System.out.println("删除失败,");
				out.println("删除失败!");
			}
	}
	
	
}
